<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${'$'}{pageContext.request.contextPath}"/>

<html>
<head>
	<title>列表</title>
</head>

<body>
	<c:if test="${'$'}{not empty message}">
		<div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>${'$'}{message}</div>
	</c:if>
	
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
	<#if fieldList?exists>
		<#list fieldList as field>
				<#if field.display=="Y">
					<th>${field.columnLabel}</th>
				</#if>
		</#list>
	</#if>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${'$'}{${classAttrName}.content}" var="entity">
			<tr>
				<#if fieldList?exists>
					<#list fieldList as field>
						<#if field.display=="Y">
							<#if field.javaColumnAttrName==firstPrimaryKey>
								<td><a href="${'$'}{ctx}/${module}/${classAttrName}/update/${'$'}{entity.${firstPrimaryKey}}">${'$'}{entity.${firstPrimaryKey}}</a></td>
							<#else>
								<#if field.javaColumnTypeName=='Date'>
									<td><fmt:formatDate value="${'$'}{entity.${field.javaColumnAttrName}}" pattern="yyyy年MM月dd日  HH时mm分ss秒" /></td>
								<#else>
									<td>${'$'}{entity.${field.javaColumnAttrName}}</td>
								</#if>
								
							</#if>
						</#if>
					</#list>
					<td><a href="${'$'}{ctx}/${module}/${classAttrName}/delete/${'$'}{entity.${firstPrimaryKey}}">删除</a></td>
				</#if>			
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<tags:pagination page="${'$'}{${classAttrName}}" paginationSize="5"/>
	<div><a class="btn" href="${'$'}{ctx}/${module}/${classAttrName}/create">新增</a></div>
</body>
</html>
